#this is server at port 1989
import socket
from time import ctime
s=socket.socket()
addr=('0.0.0.0',1989)
s.bind(addr)
s.listen(5)
while True:
    cc,cc_addr=s.accept()
    print 'the client is connecting',cc_addr
    while True:
        cr=raw_input('>')
        if not cr:
            break
        cc.send('i am 1989'+ctime()+cr)
        cr=cc.recv(512)
        if not cr:
            break
        print cr
    cc.close()
s.close()